package com.rabbit.service.impl;

import com.rabbit.redis.constant.RedisKeyConstant;
import com.rabbit.redis.service.RedisService;
import com.rabbit.service.ValidateCodeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.concurrent.TimeUnit;

/**
 * @author zjw
 * @date 2022/1/13 9:05
 */
@Service
public class ValidateCodeServiceImpl implements ValidateCodeService {

    @Resource
    private RedisService redisService;

    @Override
    public void saveImageCode(String deviceId, String code) {
        redisService.setEx(RedisKeyConstant.VERIFY_CODE_IMG_KEY + deviceId, code, RedisKeyConstant.VERIFY_CODE_EXPIRE, TimeUnit.SECONDS);
    }
}
